plot_wordcloud
method plot_wordcloud(index=None, title=None, legend=False, figsize=(900, 600), filename=None, display=True, **kwargs)[source]
Plot a wordcloud from the corpus.
The text for the plot is extracted from the column named
corpus. If there is no column with that name, an exception
is raised.
| Parameters | index: int, str, sequence or None, default=None
Index names or positions of the documents in the corpus to
include in the wordcloud. If None, it selects all documents
in the dataset.
title: str, dict or None, default=None
Title for the plot.
legend: bool or dict, default=False
Does nothing. Implemented for continuity of the API.
figsize: tuple, default=(900, 600)
Figure's size in pixels, format as (x, y).
filename: str or None, default=None
Name of the file. Use "auto" for automatic naming. If
None, the figure is not saved.
display: bool or None, default=True
Whether to render the plot. If None, it returns the
matplotlib figure.
**kwargs
Additional keyword arguments for the [Wordlcoud][wordlcoud] object.
|
| Returns | go.Figure or None
Plot object. Only returned if display=None.
|
Example
>>> from atom import ATOMClassifier
>>> from sklearn.datasets import fetch_20newsgroups
>>> X, y = fetch_20newsgroups(
... return_X_y=True,
... categories=[
... 'alt.atheism',
... 'sci.med',
... 'comp.windows.x',
... ],
... shuffle=True,
... random_state=1,
... )
>>> X = np.array(X).reshape(-1, 1)
>>> atom = ATOMClassifier(X, y)
>>> atom.textclean()
>>> atom.textnormalize()
>>> atom.plot_wordcloud()